class Base{
    public int a = 1;
    public int b = 2;

    public void methodA(){
        System.out.println("Base::methodA()");
    }
    public void methodB(){
        System.out.println("Base::methodB()");
    }

}
class Derived extends Base{
    public int a = 3;
    public int d = 4;

    public void methodB(){
        System.out.println("Derived::methodB()");
    }
    public void methodA(int val){
        System.out.println("Base::methodA(int val)"+val);
    }
    public void test(){
        methodA();
        methodA(10);
        methodB();
        super.methodB();
//        System.out.println(this.a);
//        System.out.println(this.b);
//        System.out.println(this.d);
//当父类与子类有同名的子类优先
//        System.out.println(super.a);
//用super可以访问到父类
    }
}

public class Test2 {
    public static void main(String[] args) {
        Derived derived = new Derived();
        derived.test();
    }
}
